<?php

namespace App\services\v1;

use App\Models\Activity;
use App\Models\LuckCoupon;
use App\services\BaseServices;

class ActivityServices extends BaseServices
{
    /**
     * 获取进行中活动的券
     * @return array
     */
    public function getLuckCoupon(): array
    {
        $joinRes = Activity::query()
            ->select()->from('activity as a')
            ->join('luck_coupon as l','a.id','=','l.activity_id')
            ->where('status',Activity::STATUS_ING)
            ->get()->toArray();
        return $joinRes;
    }

    /**
     * 获取进行中活动的奖品
     * @return array
     */
    public function getLuckDraw(): array
    {
        $draws = Activity::query()->from('activity as a')
            ->join('luck_draw as l','a.id','l.activity_id')
            ->where('status',Activity::STATUS_ING)
            ->get()->toArray();
        return $draws;
    }

    public function addActivity()
    {

    }
}